package com.zzyl.utils;

public class UserThreadLocalUtils {
    private static ThreadLocal<String> userThreadLocal = new ThreadLocal();

    /**
     * 添加登录用户的id
     * @param id
     */
    public static void setUserId(String id){
        userThreadLocal.set(id);
    }

    /**
     * 获取登录用户的id
     * @return
     */
    public static String getUserId(){
        return userThreadLocal.get();
    }

    /**
     * 删除线程副本数据
     */
    public static void removeUserId(){
        userThreadLocal.remove();
    }
}
